package com.lagou.task10;

public class DirectionUseTest {
    public static void test(String s1){
        switch (s1){
            case "向上":System.out.println("向上");break;
            case "向下":System.out.println("向下");break;
            case "向左":System.out.println("向左");break;
            case "向右":System.out.println("向右");break;
            default:
                System.out.println("默认");
        }
    }
    public static void test2(DirectionEnum s1){
        switch (s1){
            case UP:System.out.println("向上");break;
            case DOWN:System.out.println("向下");break;
            case LEFT:System.out.println("向左");break;
            case RIGHT:System.out.println("向右");break;
            default:
                System.out.println("默认");
        }
    }


    public static void main(String[] args) {
        DirectionUseTest.test(Direction.DOWN.getDesc());
        DirectionUseTest.test2(DirectionEnum.DOWN);

        DirectionEnum[] arr = DirectionEnum.values();
        for (int i = 0; i < arr.length; i++){
            String name = arr[i].toString();
            int pos = arr[i].ordinal();
            System.out.println("枚举类型名：" + name + "在" + pos);
        }

        DirectionEnum de = DirectionEnum.valueOf("DOWN");
        System.out.println("枚举类型名1：" + de.toString());
        int ia = DirectionEnum.DOWN.compareTo(DirectionEnum.UP);
        System.out.println("ia = " + ia);


        System.out.println("--------------------------------------");
        for (int i = 0; i < arr.length; i++){
            arr[i].show();
        }

    }


}
